package com.st.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.st.entity.Content;
import com.st.entity.Result;
import com.st.mapper.IContentMapper;
import com.st.service.IContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ContentServiceImpl extends ServiceImpl<IContentMapper, Content> implements IContentService {
    @Autowired
    private IContentMapper iContentMapper;
    //查找首页轮播图
    @Override
    public Result content() {
        QueryWrapper<Content> queryWrapper = new QueryWrapper<>();
        List<Content> contents = iContentMapper.selectList(queryWrapper);
        if (contents.isEmpty()){
            return new Result(false,"数据丢失");
        }
        return new Result(true,"查询成功",contents);
    }

}
